package me.lwn.auth.security.utils;

public interface Constants {

    String SPRING_SECURITY_FORM_REQUIRE_CAPTCHA = "require_captcha";

    String SPRING_SECURITY_FORM_LOGIN_TYPE_KEY = "type";

    String SPRING_SECURITY_FORM_LOGIN_TYPE_VALUE_PASSWORD = "password";

    String SPRING_SECURITY_FORM_LOGIN_TYPE_VALUE_SMS = "sms";

    String SPRING_SECURITY_FORM_MOBILE_KEY = "mobile";

    String SPRING_SECURITY_FORM_SMS_CODE_KEY = "code";

    String SPRING_SECURITY_FORM_CAPTCHA_KEY = "code";

    String SPRING_SECURITY_OAUTH_GRANT_TYPE_SMS_VALUE = "sms";

    String SPRING_SECURITY_OAUTH_FORM_MOBILE_KEY = "mobile";
    String SPRING_SECURITY_OAUTH_FORM_MOBILE_VALUE = "code";

    //短信登录，短信校验
    String SPRING_SECURITY_FORM_LOGIN_SMS_CODE_CACHE_KEY = "oauth2:sms:login:";
    //修改密码，短信校验
    String SPRING_SECURITY_CHANGE_PASSWORD_SMS_CODE_CACHE_KEY = "oauth2:sms:change:";
    //忘记密码，短信校验
    String SPRING_SECURITY_FORGET_PASSWORD_SMS_CODE_CACHE_KEY = "oauth2:sms:forget:";

    enum ClientSetting {

        USER_LOGIN_FAIL_LOCK_TIMES("user-login-fail-lock-times"),
        LOGIN_LOCKED_DURATION("login-locked-duration"),
        IP_LOGIN_FAIL_LOCKED("ip-login-fail-locked"),
        REQUIRE_CAPTCHA("require-captcha"),
        CUSTOMIZE_LOGIN_PAGE("customize-login-page");

        private final String key;

        ClientSetting(String key) {
            this.key = key;
        }

        public String getKey() {
            return "settings.client." + key;
        }
    }

    enum TokenSetting {

        STATE_TIME_TO_LIVE("state-time-to-live");

        private final String key;

        TokenSetting(String key) {
            this.key = key;
        }

        public String getKey() {
            return "settings.token." + key;
        }
    }
}
